#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int minRectanglesToCoverPoints(vector<vector<int>>& points, int w)
    {
        vector<int> v;
        for (auto& e : points)
            v.push_back(e[0]);
        int count = 0;
        ranges::sort(v);
        auto r = unique(v.begin(), v.end());
        v.resize(distance(v.begin(), r));
        for (int i = 0; i < v.size(); i++)
        {
            int maxnow = v[i] + w;
            while (i < v.size() && maxnow >= v[i])
                i++;
            count++;
            i--;
        }
        return count;
    }
};